// copyright 1993 Michael B. Johnson; some portions copyright 1994, MIT
// see COPYRIGHT for reuse legalities
//


#import "WW3DShapeMatrix.h"
#import "WW3DShapeCell.h"
#import "WW3DShapeBrowser.h"

#import <3Dkit/N3DShape.h>

@implementation WW3DShapeMatrix

- initFrame:(const NXRect *)r 
{
  [super initFrame:r];
  browser = nil;
  return self;
}

- awake
{
  [super awake];
  browser = nil;
  return self;
}


- (BOOL)acceptsFirstResponder { return YES; }

- cut:sender
{
  id    aCell;
  int   row, col;


  if (![self cellCount])
  {  return self;
  }

  // note: we don't allow multiple selections, so we shouldn't have to
  //       deal with a list of selected cells...

  aCell = [self selectedCell];
  [[aCell shape] unlink];
  [self getRow:&row andCol:&col ofCell:aCell];
  [self removeRowAt:row andFree:YES];
  [self sizeToCells];
  if (row) {  row--; }
  [self selectCellAt:row :col];
  // [browser setLastColumn:0];  // why doesn't this work?

  [browser display];
  [browser updateShapeCamera];
  
  return self;
}


- setBrowser:newBrowser
{
  browser = newBrowser;
  return self;
}

@end
